package com.ymatou.iapi.usersafe.testcase;

import java.util.ArrayList;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.usersafe.parameter.SecurityQuestion;
import com.ymatou.iapi.usersafe.service.GetSecurityQuestionListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
/**
*获取安全问题列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetSecurityQuestionList{
	private static GetSecurityQuestionListCall getsecurityquestionlistCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取安全问题列表");
	}

	@Before
	public void caseUp() {
		getsecurityquestionlistCall=new GetSecurityQuestionListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getsecurityquestionlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CGetSecurityQuestionList_001() {
		Logger.start(true,"获取安全问题列表成功");
		try {
			getsecurityquestionlistCall.callService();			
			Logger.verifyEquals("success", getsecurityquestionlistCall.getString("LastErrorMessage").toLowerCase(), "验证LastErrorMessage");
			Logger.verifyEquals("200", getsecurityquestionlistCall.getString("ErrorCode"), "验证ErrorCode");
			ArrayList<SecurityQuestion> list = getsecurityquestionlistCall.getResult();
			Logger.verifyEquals(true, list.size()>0, "验证问题列表数量大于0");
			for (SecurityQuestion securityQuestion : list) {
				Logger.verifyNotNull(securityQuestion.getQuestionId(), "验证QuestionId非空");
				Logger.verifyNotNull(securityQuestion.getQuestionContent(), "验证QuestionContent非空");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
